package com.study.java.jinjie.gui1;

import javax.swing.*;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Test extends Thread{


    public static void main(String[] args) {



        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");


        JFrame jFrame = new JFrame("shizhong");
        jFrame.setLocationRelativeTo(null);
        JLabel label = new JLabel( "Time: ");
        jFrame.add(label);
        jFrame.setVisible(true);

        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                Date date = new Date();
                String data1 = simpleDateFormat.format(date);
                label.setText("Time: "+data1);
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });
        thread.start();
    }

    public static void add(int x){

    }
}
